<? $this->view('head') ?>
<title>员工帐号</title>
<link rel="stylesheet" href="<?= $this->www('css/module/master.css') ?>" type="text/css" media="screen"/>
<link rel="stylesheet" href="<?= $this->www('css/module/master/cpanel.css') ?>" type="text/css" media="screen"/>
<script type="text/javascript" src="<?= $this->www('script/module/master.account.js') ?>"></script>

<? $this->view('body') ?>
<? $this->view('master/header', array('mgr' => 1)) ?>
<div class="ftt-container">
    <? $this->view('master/ftt-nav', array('tab' => 'ygzh', 'set' => 'zhsz')) ?>
    <div class="other-id">
        <div class="other-id-block" id="block1">
            <div class="other-id-title clearfix">
                <div class="title-left" style="width:50%;"><strong>员工账号</strong></div>
                <div class="title-right">
                    <input type="button" value="添加账号" class="button white" onclick="location.href='/master/account/create'" />
                </div>
            </div>
            <div class="other-id-content">
                <table class="data">
                    <thead>
                        <tr>
                            <th>角色名</th>
                            <th>姓名</th>
                            <th>登录帐号</th>
                            <th>激活状态</th>
                            <th>是否启用</th>
                            <th>允许登录</th>
                            <th>预订默认</th>
                            <th>可用操作</th>
                        </tr>
                    </thead>
                    <tbody class="tbody">
                        <? if (empty($this->masters)): ?>
                        <tr>
                            <td colspan="8" class="align-center">没有其他帐号，现在<a href="/master/account/create">新建一个</a></td>
                        </tr>
                        <? else: ?>
                        <? foreach ($this->masters as $val): ?>
                        <tr>
                            <td><?= $this->escape($val['u_rolename']) ?></td>
                            <td><?= $this->escape($val['u_realname']) ?></td>
                            <td><?= $this->escape($val['u_email']) ?></td>
                            <td><?= $val['u_active'] & (int)USER_ACTIVE_JH ? '已激活' : '未激活' ?></td>
                            <td><?= $val['u_status'] ? '是' : '否' ?></td>
                            <td><?= $val['u_active'] & (int)USER_ACTIVE_DL ? '是' : '否' ?></td>
                            <td><?= $val['u_id'] === $this->hostel['h_order_default_saleman'] ? '是' : '否' ?></td>
                            <td>
                                <? if ($val['u_id'] !== $this->master['u_id'] && !((int)$val['u_role'] & USER_ROLE_ROOTER)): ?>
                                <a href="/master/account/update?uid=<?= $val['u_id'] ?>">修改</a>
                                <? if ($val['u_id'] !== $this->hostel['h_order_default_saleman']): ?>
                                <a class="oper" href="/master/account/do-update-status?uid=<?= $val['u_id'] ?>&sta=<?= $val['u_status'] ? '0' : '1' ?>"><?= $val['u_status'] ? '停用' : '启用' ?></a>
                                <? endif; ?>
                                <a class="oper" href="/master/account/do-change-access?uid=<?= $val['u_id'] ?>"><?= $val['u_active'] & (int)USER_ACTIVE_DL ? '禁止登录' : '允许登录' ?></a>
                                <? endif; ?>

                                <? if ($val['u_status'] && $val['u_id'] !== $this->hostel['h_order_default_saleman']): ?>
                                <a class="oper" href="/master/account/do-locate?sid=<?= $val['u_id'] ?>">预订默认</a>
                                <? endif; ?>
                            </td>
                        </tr>
                        <? endforeach; ?>
                        <? endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="other-id-block" id="block2">
            <div class="other-id-title clearfix">
                <div class="title-left"><strong>最近登陆</strong></div>
            </div>
            <div class="other-id-content">
                <table class="data">
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>登录帐号</th>
                            <th style="width:20%">登陆时间</th>
                            <!-- <th style="width:20%">登陆地点(供参考)</th> -->
                            <th>登陆IP</th>
                        </tr>
                    </thead>
                    <tbody class="tbody">
                        <? if (empty($this->signinLogs)): ?>
                        <tr>
                            <td colspan="5" class="align-center">没有登录日志</td>
                        </tr>
                        <? else: ?>
                        <? foreach ($this->signinLogs as $val): ?>
                        <tr>
                            <td><?= $this->escape($val['lu_xnm']) ?></td>
                            <td><?= $this->escape($val['lu_memo']) ?></td>
                            <td title="<?= $val['lu_date'] ?>"><?= $this->format($val['lu_date'], 'man-date') . ' ' . date('H:i:s', strtotime($val['lu_date'])) ?></td>
                            <!-- <td></td> -->
                            <td><?= $this->escape($val['lu_ip']) ?></td>
                        </tr>
                        <? endforeach; ?>
                        <? endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<? $this->view('master/footer') ?>
<script type="text/javascript">$(Z.Module.master.account.index.init)</script>
<? $this->view('foot') ?>
